Micron Document




Java code coverage tools
part 4/13 · 22.4 KB total
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
TeamCitycite-ref-13[13]
• STAMP (https://www.stamp-project.eu/)cite-ref-14[14]

JCov

JCov is the tool which has been developed and used with Sun JDK (and later Oracle JDK) from the very beginning of Java: from the version 1.1. JCov is capable of measuring and reporting Java code coverage. JCov is distributed under the terms of the GNU General Public License (version 2, with the Classpath Exception). JCov has become open-source as a part of OpenJDK code tools project in 2014.

Features

JCov is capable of reporting the following types of code coverage:

• Block coverage
• Line coverage
• Branch coverage
• Method coverage

JCov implements two different ways to save the collected data:

• Into a file on the filesystem
• Onto a server (a.k.a. "network grabber")

JCov works by instrumenting Java bytecode using two different approaches:

• Static instrumentation which is done upfront, changing the tested code
• Dynamic instrumentation which is done on the fly by means of Java agent

JCov has a few more distinctive features which include, but are not limited to:

• Field coverage
• Abstract API coverage
• Direct/indirect coverage
• Per-test coverage information (a.k.a. "test scales")
• Public API and SPI which makes it possible to implement custom filtering and/or mining the coverage data

Tools using JCov

• Oracle JDK (SE and ME)
• JCK (the Java Compatibility Kit)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────